package ro.uaic.info.fmse.context.transformers.context;
import ro.uaic.info.fmse.context.transformers.enums.Multiplicity;
import ro.uaic.info.fmse.context.transformers.generic.Node;
import ro.uaic.info.fmse.context.transformers.items.ConfigurationNode;
import ro.uaic.info.fmse.context.transformers.items.RuleNode;
public class Criteria {
	public static boolean similar(Node<ConfigurationNode> configuration,
			Node<RuleNode> rule) {
		// System.out.println("Eval: " + configuration + ", " + rule);
		boolean x = // configuration.type == rule.type && 
				configuration.label.equals(rule.label); // && 
//				compare(configuration.property.inherited,
//						rule.property.occurrence);
		// System.out.println("Eval: " + configuration + ", " + rule + "\n eval to " + x +"\n");
		return x;
		
	}
	
	// compare multiplicity with occurrence
	@SuppressWarnings("unused")
	private static boolean compare(Multiplicity multiplicity, int occurrence) {
		if (multiplicity == Multiplicity.ANY
				|| multiplicity == Multiplicity.SOME)
			return true;
		if (multiplicity == Multiplicity.MAYBE && occurrence <= 1)
			return true;
		if (multiplicity == Multiplicity.NONE && occurrence == 1)
			return true;
		return false;
	}
}